import json
import re
import urllib.request
import requests
import time


prompt = ''
with open('llm_prompt22.txt', 'r', encoding='utf-8') as f:
    prompt = f.read()


    print(prompt)

    data4 = {
        "model": "qwen3-30b-a3b",
        "messages": [
            {
                "role": "user",
                "content": prompt
            }
        ],
        "chat_template_kwargs": {"enable_thinking": False}
    }

    # data4 = json.dumps(data4)
    # print(data4)
    # start_time = time.time()
    #
    # r=requests.post(url='http://172.32.153.217:8080/v1/chat/completions', data=data4,
    #               headers={'Content-Type': 'application/json','Authorization':'Bearer gpustack_869326f7407351c3_2cf97793df96a468ca9c264e24c53a4e'})
    # #print(r)
    # end_time = time.time()
    #
    # dict_obj = json.loads(r.text)
    # print("===========qwen3-30b-a3b========")
    # print(dict_obj)
    # # 计算任务执行时间
    # execution_time = end_time - start_time
    # print(f"任务执行时间: {execution_time}秒")
    # print(dict_obj["choices"][0]['message']['content'])


    # data3 = {
    #     "model": "gpt-4o",
    #     "messages": [
    #         {
    #             "role": "user",
    #             "content": prompt
    #         }
    #     ],
    #     "chat_template_kwargs": {"enable_thinking": False}
    # }
    # data3 = json.dumps(data3)
    # start_time = time.time()
    #
    # r=requests.post(url='http://172.32.153.13:28080/v1/chat/completions', data=data3,
    #               headers={'Content-Type': 'application/json','Authorization':'Bearer gpustack_869326f7407351c3_2cf97793df96a468ca9c264e24c53a4e'})
    # #print(r)
    # dict_obj = json.loads(r.text)
    # end_time = time.time()
    # execution_time=end_time-start_time
    # print("===========qwen3 32b========")
    # print(dict_obj)
    # print(f"任务执行时间: {execution_time}秒")
    # print(dict_obj["choices"][0]['message']['content'])


    data = {
        "model": "gpt-4o",
        "messages": [
            {
                "role": "user",
                "content": prompt
            }
        ]
    }
    data = json.dumps(data)
    start_time = time.time()
    r=requests.post(url='http://172.32.153.217:8080/v1/chat/completions', data=data,
                  headers={'Content-Type': 'application/json'})
    #print(r)
    dict_obj = json.loads(r.text)
    end_time = time.time()
    print("===========qwen2.5 72b int4========")
    execution_time=end_time-start_time
    print(dict_obj)
    print(f"任务执行时间: {execution_time}秒")
    print(dict_obj["choices"][0]['message']['content'])

